package com.beerq.view.me;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.RelativeSizeSpan;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.beerq.R;
import com.beerq.view.BaseActivity;
import com.beerq.view.ServicesActivity;

public class OtherActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        statusBarType=1;
        super.onCreate(savedInstanceState);
        setMainContentView(R.layout.activity_other);

        ImageView img=(ImageView)findViewById(R.id.img);

        int typee=getIntent().getIntExtra("typee",0);

        if(typee==1){
            setBarTitle("瓶盖规则");

            SpannableString spannableString = new SpannableString("当前瓶盖数："+getIntent().getStringExtra("val")) ;

            ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(0xFFA87F19);
            spannableString.setSpan(foregroundColorSpan, 6, spannableString.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE) ;

            RelativeSizeSpan relativeSizeSpan = new RelativeSizeSpan(1.5f) ;
            spannableString.setSpan(relativeSizeSpan, 6, spannableString.length(), Spannable.SPAN_COMPOSING) ;

            ((TextView)findViewById(R.id.txt_val)).setText(spannableString);

            setRightImage(R.drawable.services, new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Intent intent=new Intent(OtherActivity.this, ServicesActivity.class);
                    startActivity(intent);
                }
            });

            img.setImageDrawable(getResources().getDrawable(R.drawable.pg));

        }else {
            setBarTitle("用户等级说明");

            SpannableString spannableString = new SpannableString("您当前等级："+getIntent().getStringExtra("val")) ;

            ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(0xFFA87F19);
            spannableString.setSpan(foregroundColorSpan, 6, spannableString.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE) ;

            RelativeSizeSpan relativeSizeSpan = new RelativeSizeSpan(1.5f) ;
            spannableString.setSpan(relativeSizeSpan, 6, spannableString.length(), Spannable.SPAN_COMPOSING) ;

            ((TextView)findViewById(R.id.txt_val)).setText(spannableString);


            setRightImage(R.drawable.services, new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Intent intent=new Intent(OtherActivity.this, ServicesActivity.class);
                    startActivity(intent);
                }
            });
        }




    }
}
